﻿
@{
    Layout = null;
}


@model IPagedList<ListModel>

<div id="replaceView">

    <div class="pagedList"  data-target="#replaceView">
        @Html.PagedListPager(Model,p=>Url.Action("Index",new { page=p }),PagedListRenderOptions.MinimalWithItemCountText)
    </div>

    <table class="table">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.FirstOrDefault().Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.FirstOrDefault().City)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.FirstOrDefault().Country)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.FirstOrDefault().CountOfReviews)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.City)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Country)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CountOfReviews)
                </td>
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                    @Html.ActionLink("Details", "Details", new { id = item.Id }) |
                    @Html.ActionLink("Reviws", "Index", "RestaurantReview", new { id = item.Id }, null) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.Id })
                </td>
            </tr>
        }

    </table>
</div>

